<!-- added automatically to the collection sidebar for challenges. 
      all items should be enclosed in <li> </li> and linked with span_if_current! 
      @collection is defined, @challenge may not be. -->
<% if logged_in? %>
  <!-- signup form or link -->
  <% if (@challenge_signup = ChallengeSignup.in_collection(@collection).by_user(current_user).first) %>
    <li><%= span_if_current ts("Your Signup"), collection_signup_path(@collection, @challenge_signup) %></li>
  <% elsif @collection.challenge.user_allowed_to_sign_up?(current_user) || !@collection.moderated? || @collection.user_is_posting_participant?(current_user) %>
    <li><%= span_if_current ts("Signup Form"), new_collection_signup_path(@collection) %></li>
  <% end %>

  <!-- assignment link -->
  <% unless @collection.challenge.assignments_sent_at.nil? %>
    <% @challenge_assignments = ChallengeAssignment.in_collection(@collection).by_offering_user(current_user) %>
    <% if @challenge_assignments.size == 1 %>
      <li><%= span_if_current ts("Your Assignment"), collection_assignment_path(@collection, @challenge_assignments.first) %></li>
    <% elsif @challenge_assignments.size > 1 %>
      <li><%= span_if_current ts("Your Assignments"), user_assignments_path(current_user, :collection_id => @collection.name) %>
    <% end %>
  <% end %>

  <% if @collection.challenge.user_allowed_to_see_signups?(current_user) %>
    <li>
      <%= span_if_current ts("Signups (%{count})", :count => @collection.signups.count), collection_signups_path(@collection) %>
    </li>
  <% end %>
  <li>
    <%= span_if_current ts("Signup Summary"), summary_collection_signups_path(@collection) %>
  </li>

  <% if @collection.challenge.user_allowed_to_see_assignments?(current_user) %>
    <% if @collection.challenge.assignments_sent_at.nil? %>
      <li><%= span_if_current ts("Matching"), collection_potential_matches_path(@collection) %></li>
    <% else %>
      <li><%= span_if_current ts("Assignments"), collection_assignments_path(@collection) %></li>
    <% end %>
  <% end %>
    
<% end %>